<template>
    <div class="login-container">
        <div class="top-container">
            <div class="logo">
                <img src="../../assets/images/logo.png" alt="">
            </div>
            <div class="user">
                <div class="user-text">
                    <span>招商热线：<span style="color: #229AFF;">186-1139-8650</span></span>
                </div>
            </div>
        </div>
        <div class="login-box">
            <div class="login-form">
                <div class="title">
                    <h3 class="forget-password">忘记密码</h3>
                    <h3 class="back-login" @click="backLoginHandler">返回登录</h3>
                </div>
                <el-form ref="registerFormRef" :model="registerForm" :rules="registerRule" label-width="auto"
                    class="form-box" size="large" status-icon>
                    <el-form-item prop="phoneNum">
                        <el-input :prefix-icon="Iphone" v-model="registerForm.phoneNum" placeholder="请输入手机号" />
                    </el-form-item>
                    <el-form-item class="ib" prop="smsNum">
                        <el-input :prefix-icon="List" v-model="registerForm.smsNum" placeholder="请输入短信验证码" />
                        <el-button type="primary" @click="smsHandler">获取验证码</el-button>
                    </el-form-item>
                    <el-form-item prop="password">
                        <el-input :prefix-icon="Lock" type="password" v-model="registerForm.password" placeholder="请输入密码" />
                    </el-form-item>
                    <el-form-item prop="repassword">
                        <el-input :prefix-icon="Lock" type="password" v-model="registerForm.repassword"
                            placeholder="请重复输入密码" />
                    </el-form-item>
                    <el-form-item class="login-btn">
                        <el-button type="primary" @click="loginHandler">立即登录</el-button>
                    </el-form-item>
                </el-form>
            </div>
        </div>
    </div>
</template>
<script setup lang="ts">
import { ref, reactive } from "vue"
import { Iphone } from "@element-plus/icons-vue"
import { List } from "@element-plus/icons-vue"
import { Lock } from "@element-plus/icons-vue"
import { useRouter } from "vue-router"

const router = useRouter()

const registerForm = reactive({
    phoneNum: "",
    smsNum: "",
    password: "",
    repassword: ""
})

const registerRule = reactive({
    phoneNum: [
        { required: true, message: '请输入手机号码', trigger: 'blur' }
    ],
    smsNum: [
        { required: true, message: '请输入验证码', trigger: 'blur' },
    ],
    password: [
        { required: true, message: '请输入密码', trigger: 'blur' },
    ],
    repassword: [
        { required: true, message: '请重复输入密码', trigger: 'blur' },
    ]
})

const smsHandler = () => {

}

const loginHandler = () => {

}

const backLoginHandler = () =>{
    router.push("/login")
}

</script>
<style lang="less" scoped>
.login-container {

    width: 100%;
    height: 100vh;
    background: url("../../assets/images/login-bg.png") no-repeat;
    background-position: center;
    background-size: cover;

    .top-container {
        width: 100%;
        height: 60px;
        line-height: 60px;
        background: #fff;
        position: absolute;
        box-shadow: 0px 3px 6px 0px rgba(72, 94, 132, 0.1);
        z-index: 999;
        display: flex;

        .logo {
            display: flex;
            justify-content: center;
            align-items: center;

            img {
                display: block;
                cursor: pointer;
                height: 30px;
            }
        }

        .user {
            flex: 1;
            display: flex;
            justify-content: flex-end;
            align-items: center;

            .user-icon {
                margin-right: 10px;

                img {
                    display: block;
                    width: 40px;
                    height: 40px;
                    border-radius: 50%;
                }
            }

            .user-text {
                span {
                    margin-right: 10px;
                    font-weight: 700;
                    font-size: 16px;
                }
            }
        }
    }

    .login-box {
        width: 100%;
        height: 100vh;
        display: flex;
        align-items: center;

        .login-form {
            position: absolute;
            margin-top: -60px;
            width: 400px;
            right: 100px;
            padding: 20px 50px;
            background: #fff;
            box-shadow: 0 0 15px rgba(100, 100, 100, .2);

            .title {
                display: flex;
                justify-content: space-around;
                margin: 30px 0;

                .forget-password {
                    font-weight: 400;
                    font-size: 18px;
                    color: #394565;
                    cursor: pointer;

                    &:after {
                        content: '';
                        width: 40px;
                        height: 3px;
                        display: block;
                        margin: 0 auto;
                        margin-top: 4px;
                        background-color: #006EFF;
                        border-radius: 30px;
                    }
                }

                .back-login {
                    font-weight: 400;
                    font-size: 18px;
                    color: #989DA1;
                    cursor: pointer;
                }
            }

            .ib {
                .el-form-item__content {
                    .el-input {
                        flex: 1;
                        margin-right: 10px;
                    }
                }
            }

            .login-btn {
                margin-top: 50px;

                button {
                    flex: 1;
                }
            }
        }
    }
}
</style>
  